msg.obj = res;
        mHandler.sendMessage(msg);
        }
@Override
public void onFailure(Call call, IOException e) {

        }
        });
        }
class MHandler extends Handler {
    @Override
    public void  dispatchMessage(Message msg){
        super.dispatchMessage(msg);
        switch (msg.what){
            case MSG_COURSE_OK:
                if(msg.obj != null){
                    String vlResult = (String) msg.obj;
                    List<CourseBean> cbl=
                            JsonParse.getInstance().getCourseList(vlResult);
                    adapter.setDate(cbl);
                }
                break;
            case MSG_BANNER_OK:
                if(msg.obj != null){
                    String vlResult = (String) msg.obj;
                    List<BannerBean> bbl=
                            JsonParse.getInstance().getBannerList(vlResult);
                    ada.setData(bbl);
                    vpi.setCount(bbl.size());
                    vpi.setCurrentPosition(0);
                }
                break;
            case MSG_AD_SLID:
                if(ada.getCount() > 0){
                    adPager.setCurrentItem(adPager.getCurrentItem() +1);
                }
                break;
        }
    }
}
    private void resetSize() {
        int sw = getScreenWidth(mContext);
        int adLheight = sw / 2;
        ViewGroup.LayoutParams adlp = adBannerLay.getLayoutParams();
        adlp.width = sw;
        adlp.height  =adLheight;
        adBannerLay.setLayoutParams(adlp);
    }
    private int getScreenWidth(Activity context) {
        DisplayMetrics metrics = new DisplayMetrics();
        Display display = context.getWindowManager().getDefaultDisplay();
        display.getMetrics(metrics);
        return metrics.widthPixels;
    }
    public View getView(){
        if(mCurrentView == null){
            initView();
        }
        return mCurrentView;
    }
    public void showView(){
        if(mCurrentView == null){
            initView();
        }
        mCurrentView.setVisibility(View.VISIBLE);
    }

}

